// FileLayer.h: interface for the CFileLayer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FILELAYER_H__D67222B3_1B00_4C77_84A4_CEF6D572E181__INCLUDED_)
#define AFX_FILELAYER_H__D67222B3_1B00_4C77_84A4_CEF6D572E181__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "BaseLayer.h"

class CFileAppLayer 
	: public CBaseLayer  
{
private:
	inline void		ResetHeader( ) ;
	HANDLE h_file;
	BOOL m_file_receive_ready;
public:
	BOOL	Receive( unsigned char* ppayload) ;
	BOOL	Send( unsigned char* ppayload, int nlength );

	void setFileSize(unsigned long len);
	unsigned long GetFileSize();
	void setFileType(unsigned short type);
	unsigned short GetFileType();
	void setFileMsgType(unsigned char msgType);
	unsigned char GetFileMsgType();
	void setFileSeqNum(unsigned long seq_num);
	unsigned long GetFileSeqNum();

	typedef struct _FILE_APP
	{
		unsigned long fapp_totlen;
		unsigned short fapp_type;
		unsigned char fapp_msg_type;
		unsigned char ed;
		unsigned long fapp_seq_num;
		unsigned char fapp_data[FAPP_DATA_SIZE];
	}FILE_APP, *LPFILE_APP;
	CFileAppLayer( char* pName );
	virtual ~CFileAppLayer();

protected:
	FILE_APP m_fileHeader;
};

#endif // !defined(AFX_FILELAYER_H__D67222B3_1B00_4C77_84A4_CEF6D572E181__INCLUDED_)
